package edu.scut.autoProcessor.dao;

import java.io.Reader;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public abstract class AbstractDao {

	private static final Log logger = LogFactory.getLog(AbstractDao.class);
	
	protected static SqlSessionFactory factory;
	
	static{
		final String PATH = "mybatis/conf.xml";
		
		try{
			Reader reader = Resources.getResourceAsReader(PATH);
			factory = new SqlSessionFactoryBuilder().build(reader);
		}catch(Exception e){
			logger.error(e.getMessage());
			e.printStackTrace();
		}
	}
}
